from selenium import webdriver
from selenium.webdriver.common.by import By
from time import sleep, strftime

driver = webdriver.Firefox()
driver.maximize_window()
url = 'file:///root/NSD2408/html/registerA.html'
driver.get(url)
# 输入用户名
driver.find_element(By.CSS_SELECTOR, '#userA').send_keys('admin')
# 截屏
# 使用时间戳作为文件的名称，不会出现重复
driver.get_screenshot_as_file(f'../images/{strftime("%Y_%m_%d_%H_%M_%S")}.png')


sleep(3)
driver.quit()